package top.tresman.cxxcommon.annotation;

import jakarta.validation.Constraint;
import jakarta.validation.Payload;
import top.tresman.cxxcommon.contract.EnumValueProvider;
import top.tresman.cxxcommon.validator.EnumValidator;

import java.lang.annotation.*;

@Target({ElementType.FIELD, ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Constraint(validatedBy = EnumValidator.class)
public @interface EnumRule {
    Class<? extends EnumValueProvider> value(); // 指定枚举类

    String message() default "枚举数据错误";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};
}
